/**
 * 
 */
package slhs.tempo.scriptGenerator;

import java.awt.LayoutManager;
import java.awt.event.ActionEvent;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

import org.mlc.swing.layout.LayoutConstraintsManager;

/**
 * UnimodalVisualProbeDataPanelHandler.java
 * 
 * @author Swapnil Devikar
 * 
 */
public class UnimodalVisualProbeDataPanelHandler extends JPanel implements PanelHandler {
    private static String UNIMODAL_VISUAL_PROBE_DATA_PANEL_LAYOUT = "UNIMODAL_VISUAL_PROBE_DATA_PANEL_LAYOUT.xml";

    private JPanel unimodalVisualProbeDataPanel;
    private JLabel categoriesLabel;
    private JLabel expectedAnswerLabel;
    private JComboBox expectedAnswerComboBox;
    private JComboBox probeNumberComboBox;
    private JComboBox categoriesComboBox;
    private JLabel probeNumberLabel;

    public static DefaultComboBoxModel numberOfProbesModel;

    public UnimodalVisualProbeDataPanelHandler() {
	initComponents();
	addComponents();
    }

    /**
     * 
     */
    private void initComponents() {
	unimodalVisualProbeDataPanel = new JPanel();
	categoriesLabel = new JLabel("Categories");
	expectedAnswerLabel = new JLabel("Expected Answer");
	expectedAnswerComboBox = new JComboBox(UtilityConstants.EXPECTED_ANSWERS);
	probeNumberComboBox = new JComboBox();
	categoriesComboBox = new JComboBox(UtilityConstants.CATEGORIES);
	probeNumberLabel = new JLabel("Probe Number");
	numberOfProbesModel = new DefaultComboBoxModel();
    }

    /**
     * 
     */
    private void addComponents() {
	LayoutConstraintsManager layoutConstraintsManager = LayoutConstraintsManager.getLayoutConstraintsManager(this
		.getClass().getResourceAsStream(UNIMODAL_VISUAL_PROBE_DATA_PANEL_LAYOUT));
	LayoutManager panelLayout = layoutConstraintsManager.createLayout("panel", this);
	unimodalVisualProbeDataPanel.setLayout(panelLayout);
	unimodalVisualProbeDataPanel.add(categoriesLabel, "categoriesLabel");
	unimodalVisualProbeDataPanel.add(expectedAnswerLabel, "expectedAnswerLabel");
	unimodalVisualProbeDataPanel.add(expectedAnswerComboBox, "expectedAnswerComboBox");
	unimodalVisualProbeDataPanel.add(probeNumberComboBox, "probeNumberComboBox");
	unimodalVisualProbeDataPanel.add(categoriesComboBox, "categoriesComboBox");
	unimodalVisualProbeDataPanel.add(probeNumberLabel, "probeNumberLabel");

	// control configuration
	categoriesComboBox.setEditable(true);
	probeNumberComboBox.setModel(numberOfProbesModel);
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
     */
    @Override
    public void actionPerformed(ActionEvent arg0) {
	// TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see slhs.tempo.scriptGenerator.PanelHandler#getPanel()
     */
    @Override
    public JPanel getPanel() {
	// TODO Auto-generated method stub
	return unimodalVisualProbeDataPanel;
    }

}
